﻿namespace FimCmTools.Providers
{
    using System;
    using System.Configuration;
    using Microsoft.Clm;
    using FimCmTools.Common;

    /// <summary>
    /// for testing. returns a configurable PIN
    /// </summary>
    public class CustomUserPinProvider : ICustomUserPinGenerator
    {
        /// <summary>
        /// Generates the user pin.
        /// </summary>
        /// <param name="scUuid">The sc UUID.</param>
        /// <param name="bHandled">if set to <c>true</c> [b handled].</param>
        /// <returns></returns>
        public string GenerateUserPin(Guid scUuid, ref bool bHandled)
        {

            string pin = Utilities.GetConfigString("CustomPin", null);
            if (string.IsNullOrEmpty(pin))
            {
                bHandled = true;
                return pin;
            }
            else
            {
                bHandled = false;
                return null;
            }

        }
    }
}
